<template>
    <TheForm
      ref="formRefs"
      title="新增充值"
      :options="rechargeFormOptions"
      :form.sync="rechargeForm"
      tip="提交后不可修改，请确认信息无误"
      @submit="submit"
    ></TheForm>
  </template>
  
  <script>
  import TheForm from "@/components/TheCreateForm";
  export default {
    components: {
      TheForm,
    },
    data() {
      return {
        rechargeForm: {},
        rechargeFormOptions: [
          {
            type: "select",
            field: "stockLibraryCode",
            title: "充值商家",
            default: "",
            placeholder: "请选择...",
            api: null,
            rules: [
              { required: true, message: "请选择合作商家", trigger: "change" },
            ],
          },
  
          {
            type: "input-number",
            field: "libraryName",
            title: "充值金额",
            default: "",
            placeholder: "请输入...",
            precision: 0,
            controls: false,
            max: 999999,
            min: 100,
            rules: [
              { required: true, message: "请输入充值金额...", trigger: "blur" },
              {
                trigger: "change",
                min: 100,
                max: 999999,
                message: "请输入100-999999范围内数字",
              },
            ],
          },
          {
            type: "select",
            field: "stockLibraryCode",
            title: "充值渠道",
            default: "",
            placeholder: "请选择...",
            options: [
              { label: "支付宝", value: "alipay" },
              { label: "微信", value: "weChat" },
              { label: "银行卡", value: "bank" },
              { label: "其他", value: "other" },
            ],
            rules: [{ required: true, message: "请选择...", trigger: "change" }],
          },
          {
            type: "upload",
            field: "libraryAddressDetail",
            title: "转账凭证",
            default: [],
            maxlength: 6,
            rules: [
              { required: true, message: "请上传转账凭证...", trigger: "change" },
            ],
          },
          {
            type: "textarea",
            field: "remark",
            title: "备注",
            default: "",
            maxlength: 40,
            placeholder: "备注...",
          },
        ],
      };
    },
    mounted() {},
    methods: {
      submit(formValue) {
        this.$emit("submit", formValue);
      },
      onShow() {
        this.$refs.formRefs.open();
      },
    },
  };
  </script>
  